/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tletlis.model;

/**
 * This class desribes a square of an area represented
 * as a position, which will make it easier to divied areas
 * in smaller parts. It has a static length which represent 
 * both the width and the height of the square.
 * @author Gustav
 */
public class Position {
    
    private static int length;
    private final int y;
    private final int x;
    
    /** Creates a new position
     * 
     * @param x the x coordinate off the position
     * @param y the y coordinate off the position
     */
    public Position(int y,int x) {
        this.y = y;
        this.x = x;
    }
    /** Sets the length, which represent both the width and 
     * the height.
     * @param l The length.
     */
    public static void setLength(int l) {
        length = l;
    }
    /**
     * Returns the length, which is both the width and the height.
     * @return The length.  
     */
    public static int getLength(){
        return length;
    }
    /**
     * Returns the x coordinate off the position
     * @return The x coordinate
     */
    public int getX() {
        return x;
    }
    /**
     * Returns the y coordinate off the position
     * @return The y coordinate
     */
    public int getY() {
        return y;
    }
    @Override
    public boolean equals(Object o) {
        Position temp = (Position)o;
        
        if((this.x == temp.x) && (this.y == temp.y)) {
        
            return true;

        }
        
        return false;
    }

    public String toString() {
        return y+","+x;
    }
}
